﻿using System;
using Jxym.Common.JSON;
using Newtonsoft.Json;
using Jxym.DBUtility;
using Jxym.wlkc2011.Module.Default.model;
using System.Data.SqlClient;
using System.Collections.Generic;

namespace Jxym.wlkc2011.Module.Default.SERVER.module
{
    public partial class MenuList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string returnStr = "{List:[],Count:0}";
                try
                {
                    int startIndex = 0, limit = 0;
                    if (Request.Params["start"] != null) startIndex = Convert.ToInt32(Request.Params["start"]);
                    if (Request.Params["limit"] != null) limit = Convert.ToInt32(Request.Params["limit"]);

                    if (limit != 0)
                    {
                        MsSqlDal<User_TreeMenu> list = new MsSqlDal<User_TreeMenu>();
                        PageBean pb = new PageBean();
                        pb.Count = list.GetPageCount("", null);
                        pb.List = list.GetPageList("", null, startIndex, limit);
                        returnStr = JsonConvert.SerializeObject(pb);
                    }

                }
                catch (Exception) { }
                Response.Write(returnStr);
            }
        }
    }
}